package com.wjm.blog.common.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.FieldFill.INSERT;
import static com.baomidou.mybatisplus.annotation.FieldFill.INSERT_UPDATE;

/**
 * 公共实体类
 *
 * @author Ailos
 * @version 1.0
 * @date 2020/4/22 10:31
 */
@Data
public class BaseEntity<T extends Model> extends Model<T> {

    /**
     * 主键ID
     */
    @TableId("ID")
    private Long id;

    /**
     * 是否删除 0：否，1：是
     */
    @TableLogic
    @TableField("IS_DELETED")
    private Integer isDeleted;

    /**
     * 创建人标识
     */
    @TableField(value = "CREATED_BY", fill = INSERT)
    private Long createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "CREATED_TIME", fill = INSERT)
    private LocalDateTime createdTime;

    /**
     * 修改人标识
     */
    @TableField(value = "UPDATED_BY", fill = INSERT_UPDATE)
    private Long updatedBy;

    /**
     * 修改时间
     */
    @TableField(value = "UPDATED_TIME", fill = INSERT_UPDATE)
    private LocalDateTime updatedTime;

}
